#include<iostream>
using namespace std;

//类指针和结构体使用指针一样，需要用->来访问成员

class Box
{
    public:
        Box(double l=2.0, double b = 2.0, double h = 2.0)
        {
            cout << "constructor called" << endl;
            length = l;
            width = b;
            height = h;
        }

        double Volume()
        {
            return length * width * this->height;
        }

    private:
        double length, width, height;
};

int main(void){
    Box Box1(3.3, 1.2, 1.5);
    Box *ptrBox;

    ptrBox = &Box1;
    cout << "volume of box1: " << ptrBox->Volume() <<endl;

    return 0;
}
